﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
      static  string a = @"
                ffmpeg version N - 93548 - g4d2f62150d Copyright(c) 2000 - 2019 the FFmpeg developers
       built with gcc 8.2.1(GCC) 20190212
  configuration: --enable - gpl--enable - version3--enable - sdl2--enable - fontconfig--enable - gnutls--enable - iconv--enable - libass--enable - libdav1d--enable - libbluray--enable - libfreetype--enable - libmp3lame--enable - libopencore - amrnb--enable - libopencore - amrwb--enable - libopenjpeg--enable - libopus--enable - libshine--enable - libsnappy--enable - libsoxr--enable - libtheora--enable - libtwolame--enable - libvpx--enable - libwavpack--enable - libwebp--enable - libx264--enable - libx265--enable - libxml2--enable - libzimg--enable - lzma--enable - zlib--enable - gmp--enable - libvidstab--enable - libvorbis--enable - libvo - amrwbenc--enable - libmysofa--enable - libspeex--enable - libxvid--enable - libaom--enable - libmfx--enable - amf--enable - ffnvcodec--enable - cuvid--enable - d3d11va--enable - nvenc--enable - nvdec--enable - dxva2--enable - avisynth--enable - libopenmpt
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 48.101 / 58. 48.101
  libavformat    58. 27.100 / 58. 27.100
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 48.100 / 7. 48.100
  libswscale      5.  4.100 / 5.  4.100
  libswresample   3.  4.100 / 3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'f:\jiaoxiangyue.mov':
  Metadata:
    major_brand: qt
minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2018 - 05 - 28T09: 04:53.000000Z
       Duration: 00:04:35.80, start: 0.000000, bitrate: 402676 kb / s
    Stream #0:0(eng): Video: mjpeg (Baseline) (jpeg / 0x6765706A), yuvj422p(pc, bt470bg/smpte170m/bt709), 3840x768 [SAR 72:72 DAR 5:1], 402673 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc (default)
    Metadata:
      creation_time: 2018 - 05 - 28T09: 04:53.000000Z
        handler_name    : 苹果视频媒体处理程序
        encoder         : Photo - JPEG
      timecode: 00:00:00:00
    Stream #0:1(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time: 2018 - 05 - 28T09: 13:23.000000Z
        handler_name    : 时间码媒体处理程序
        timecode        : 00:00:00:00
At least one output file must be specified

                    ";
        static void Main(string[] args)
        {
            string d = "Duration: ";
            int durationIndex = a.IndexOf(d);
            var durationStr = a.Substring(durationIndex+d.Length);
            int startIndex = durationStr.IndexOf(", start: ");
            var time = durationStr.Substring(0,startIndex);
            Console.WriteLine(time);
           // 00:04:35.80
           TimeSpan t = TimeSpan.ParseExact(time, "hh\\:mm\\:ss\\.ff", CultureInfo.InvariantCulture);
           
            Console.WriteLine(t.ToString());
            Console.Read();
        }
    }
}
